#pragma once
#include "AssetObject.h"
#include "HLSLAsset.h"
namespace YXX_AS
{
	struct ParameterLayout
	{
		using Slot = UINT;
		std::unordered_map<std::string, Slot> SRVLayout;

		using VarName = std::string;
		using Offset = UINT;
		struct ItemInfo
		{
			Offset StartOffset;
			UINT Size;
		};
		using CBufStructure = std::unordered_map<VarName, ItemInfo>;
		struct CbufferInfo
		{
			std::string cbufferName;
			UINT startSlot;
			UINT byteWidth;
			struct HashFunc
			{
				size_t operator()(const CbufferInfo& i) const {
					return i.startSlot;
				}
			};
			bool operator==(const CbufferInfo& i)const
			{
				return i.startSlot == startSlot;
			}
		};
		std::unordered_map<CbufferInfo, CBufStructure, CbufferInfo::HashFunc> CBufLayout;
	};
	enum class RS
	{
		DEFAULT,
		CULL_BACK,
		CULL_NONE,
		CULL_FRONT,
		FILL_WIREFRAME,

		NUM_RS_PRESET
	};
	struct ShaderAsset :AssetObject
	{
		std::shared_ptr<HLSL> hlsl;

		RS rasterState = RS::DEFAULT;

		float vieeportWidth;
		float viewportHeight;
	public:
		ParameterLayout parameterLayout;
	};
}

USRefl_Enum_Non_Intrusive(YXX_AS::RS, DEFAULT, CULL_BACK, CULL_NONE, CULL_FRONT, FILL_WIREFRAME);